//
// Created by Castle on 2025/10/21.
//

#include <bitset>
#include <iomanip>
#include <iostream>

int main() {
    const int COLUMN_WIDTH {20};

    const unsigned char mask_bit_1 {0b00000001};
    const unsigned char mask_bit_5 {0b00100000};


    unsigned char var {0b00000000}; // Starts off all bits off

    std::cout << std::setw(COLUMN_WIDTH) << "var : "
        << std::setw(COLUMN_WIDTH) << std::bitset<8>(var) << std::endl;

    // Set bit 1
    std::cout << "Setting bit in position 1 : " << std::endl;
    var |= mask_bit_1;
    std::cout << std::setw(COLUMN_WIDTH) << "var : "
        << std::setw(COLUMN_WIDTH) << std::bitset<8>(var) << std::endl;

    // Set bit 5
    std::cout << "Setting bit in position 5 : " << std::endl;
    var |= mask_bit_5;
    std::cout << std::setw(COLUMN_WIDTH) << "var : "
        << std::setw(COLUMN_WIDTH) << std::bitset<8>(var) << std::endl;


    return 0;
}
